<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
	</body>
	<script>
		/**
		 * 格式化分钟
		 * @param {Object} min  单位分钟 
		 */
		function minuteFormat(min){
			if(!min){
				return '-';
			}
			var result='';
			if(min%(60*24*30*12)!=min){
				result=parseInt(min/(60*24*30*12))+"年";
				min=min-(parseInt(min/(60*24*30*12))*(60*24*30*12));
			}
			if(min%(60*24*30)!=min){
				result+=parseInt(min/(60*24*30))+"月";
				min=min-(parseInt(min/(60*24*30))*(60*24*30));
			}			
			if(min%(60*24)!=min){
				result+=parseInt(min/(60*24))+"天";
				min=min-(parseInt(min/(60*24))*(60*24));
			}
			if(min%60!=min){
				result+=parseInt(min/60)+"小时";
				min=min-(parseInt(min/60)*60);
			}
			if(min>0){
				result+=min+"分";
			}
			if(result==''){
				return "刚刚";
			}else{
				result+="前";
			}
			return result;
		}
		
		console.info(minuteFormat(parseInt((new Date()-new Date('2019-05-22 13:43:40'))/1000/60)))
		
		
	</script>
</html>
